const { Schema, model } = require('mongoose');
const moment = require('moment')

const ordersSchema = new Schema({
    //定义好名称后数据库定义名称要一样
    name: String,
    parkingLocation: String,
    state: {
        type: String,
        default: 1
    },
    endTime: String,
    orderStart: {
        type: String,
        default: moment().format('YYYY-MM-DD HH:mm'),
    },
    tenantsId: {
        type: Schema.Types.ObjectId,
        ref: "tenantsModel"
    },
    parkingsId: {
        type: Schema.Types.ObjectId,
        ref: "parkingsModel"
    }
})

const ordersModel = model('ordersModel', ordersSchema, 'orders')
module.exports.ordersModel = ordersModel



